/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  @endpointMap = {
    ap-northeast-1 = 'workorder.ap-northeast-1.aliyuncs.com',
    ap-southeast-1 = 'workorder.ap-southeast-1.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('workorder', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CloseTicketRequest {
  ticketId?: string(name='TicketId'),
  uid?: string(name='Uid'),
}

model CloseTicketResponseBody = {
  code?: int32(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CloseTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CloseTicketResponseBody(name='body'),
}

async function closeTicketWithOptions(request: CloseTicketRequest, runtime: Util.RuntimeOptions): CloseTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CloseTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function closeTicket(request: CloseTicketRequest): CloseTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return closeTicketWithOptions(request, runtime);
}

model CreateTicketRequest {
  categoryId?: string(name='CategoryId', example='7161'),
  creatorId?: string(name='CreatorId', example='1289427240739141'),
  description?: string(name='Description'),
  email?: string(name='Email', description='sdahkjdshga@qq.com'),
  fileNameList?: [ string ](name='FileNameList'),
  secretInfo?: {
    content?: string(name='Content'),
    fileNameList?: [ string ](name='FileNameList'),
  }(name='SecretInfo'),
  severity?: int32(name='Severity', example='1'),
  title?: string(name='Title'),
}

model CreateTicketShrinkRequest {
  categoryId?: string(name='CategoryId', example='7161'),
  creatorId?: string(name='CreatorId', example='1289427240739141'),
  description?: string(name='Description'),
  email?: string(name='Email', description='sdahkjdshga@qq.com'),
  fileNameListShrink?: string(name='FileNameList'),
  secretInfoShrink?: string(name='SecretInfo'),
  severity?: int32(name='Severity', example='1'),
  title?: string(name='Title'),
}

model CreateTicketResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: string(name='Data', example='0005PYGCW'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='0254B7DE-7365-57B4-8E38-14FE927E3FEB'),
  success?: boolean(name='Success', example='True'),
}

model CreateTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTicketResponseBody(name='body'),
}

async function createTicketWithOptions(tmpReq: CreateTicketRequest, runtime: Util.RuntimeOptions): CreateTicketResponse {
  Util.validateModel(tmpReq);
  var request = new CreateTicketShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.fileNameList)) {
    request.fileNameListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.fileNameList, 'FileNameList', 'simple');
  }
  if (!Util.isUnset(tmpReq.secretInfo)) {
    request.secretInfoShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.secretInfo, 'SecretInfo', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.secretInfoShrink)) {
    query['SecretInfo'] = request.secretInfoShrink;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.email)) {
    body['Email'] = request.email;
  }
  if (!Util.isUnset(request.fileNameListShrink)) {
    body['FileNameList'] = request.fileNameListShrink;
  }
  if (!Util.isUnset(request.severity)) {
    body['Severity'] = request.severity;
  }
  if (!Util.isUnset(request.title)) {
    body['Title'] = request.title;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTicket(request: CreateTicketRequest): CreateTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTicketWithOptions(request, runtime);
}

model EvaluateTicketRequest {
  content?: string(name='Content'),
  score?: string(name='Score', example='1'),
  solved?: boolean(name='Solved', example='true'),
  ticketId?: string(name='TicketId', example='001ET1BU1P'),
  uid?: string(name='Uid'),
}

model EvaluateTicketResponseBody = {
  code?: int32(name='Code', example='200'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', example='C1DA4C6F-963E-5741-AB57-67A554D102FD'),
  success?: boolean(name='Success', example='true'),
}

model EvaluateTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EvaluateTicketResponseBody(name='body'),
}

async function evaluateTicketWithOptions(request: EvaluateTicketRequest, runtime: Util.RuntimeOptions): EvaluateTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.score)) {
    body['Score'] = request.score;
  }
  if (!Util.isUnset(request.solved)) {
    body['Solved'] = request.solved;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'EvaluateTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function evaluateTicket(request: EvaluateTicketRequest): EvaluateTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return evaluateTicketWithOptions(request, runtime);
}

model GetAttachmentUploadUrlRequest {
  fileName?: string(name='FileName', example='81A0D93D-54D7-4529-ABFA-633ED63223BA.jpg'),
}

model GetAttachmentUploadUrlResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: {
    getSignedUrl?: string(name='GetSignedUrl', example='https://gts-workorder-pre.oss-cn-beijing.aliyuncs.com
/20220314/cabb80c3-430b-4079-a9f2-d2a0d1c2a587.png?Expires=1647328689&OSSAccessKeyId=LTAI4FrZPa9N1nGWs6Nykp3A&Signature=AbSEh26G3oYrJ8ivr4B0xzF89zk%3D'),
    objectKey?: string(name='ObjectKey', example='cdb5d174-c282-4b2d-9048-e74ea2223127.jpg'),
    putSignedUrl?: string(name='PutSignedUrl', example='https://gts-workorder-pre.oss-cn-beijing.aliyuncs.com
/20220314/cabb80c3-430b-4079-a9f2-d2a0d1c2a587.png?Expires=1647328689&OSSAccessKeyId=LTAI4FrZPa9N1nGWs6Nykp3A&Signature=AbSEh26G3oYrJ8ivr4B0xzF89zk%3D'),
  }(name='Data'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='ED195C2C-787F-511C-8204-714456781861'),
  success?: boolean(name='Success', example='true'),
}

model GetAttachmentUploadUrlResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAttachmentUploadUrlResponseBody(name='body'),
}

async function getAttachmentUploadUrlWithOptions(request: GetAttachmentUploadUrlRequest, runtime: Util.RuntimeOptions): GetAttachmentUploadUrlResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fileName)) {
    body['FileName'] = request.fileName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetAttachmentUploadUrl',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAttachmentUploadUrl(request: GetAttachmentUploadUrlRequest): GetAttachmentUploadUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAttachmentUploadUrlWithOptions(request, runtime);
}

model GetMqConsumerTagResponseBody = {
  code?: int32(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetMqConsumerTagResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetMqConsumerTagResponseBody(name='body'),
}

async function getMqConsumerTagWithOptions(runtime: Util.RuntimeOptions): GetMqConsumerTagResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetMqConsumerTag',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getMqConsumerTag(): GetMqConsumerTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMqConsumerTagWithOptions(runtime);
}

model GetTicketRequest {
  ticketId?: string(name='TicketId', example='001571BTXC'),
  uid?: string(name='Uid'),
}

model GetTicketResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: {
    categoryId?: string(name='CategoryId', example='7161'),
    createTime?: long(name='CreateTime', example='1623396736000'),
    creatorId?: string(name='CreatorId', example='1168025'),
    description?: string(name='Description'),
    severity?: {
      label?: string(name='Label'),
      value?: string(name='Value', example='1'),
    }(name='Severity'),
    status?: {
      label?: string(name='Label'),
      value?: string(name='Value', example='6'),
    }(name='Status'),
    ticketId?: string(name='TicketId', example='0005PYGCW'),
    title?: string(name='Title'),
  }(name='Data'),
  message?: string(name='Message', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='C499BB0F-630D-5BE6-B3EA-5FCD95B85503'),
  success?: boolean(name='Success', example='True'),
  totalCount?: long(name='TotalCount', example='108'),
}

model GetTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTicketResponseBody(name='body'),
}

async function getTicketWithOptions(request: GetTicketRequest, runtime: Util.RuntimeOptions): GetTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTicket(request: GetTicketRequest): GetTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTicketWithOptions(request, runtime);
}

model ListCategoriesRequest {
  language?: string(name='Language'),
  name?: string(name='Name'),
  productId?: long(name='ProductId'),
}

model ListCategoriesResponseBody = {
  code?: int32(name='Code'),
  data?: [ 
    {
      categoryId?: long(name='CategoryId'),
      categoryName?: string(name='CategoryName'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListCategoriesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCategoriesResponseBody(name='body'),
}

async function listCategoriesWithOptions(request: ListCategoriesRequest, runtime: Util.RuntimeOptions): ListCategoriesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.productId)) {
    body['ProductId'] = request.productId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListCategories',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCategories(request: ListCategoriesRequest): ListCategoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCategoriesWithOptions(request, runtime);
}

model ListProductsRequest {
  language?: string(name='Language'),
  name?: string(name='Name', example='ecs'),
}

model ListProductsResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: [ 
    {
      directoryId?: long(name='DirectoryId', example='1'),
      directoryName?: string(name='DirectoryName'),
      productList?: [ 
        {
          productId?: long(name='ProductId', example='7160'),
          productName?: string(name='ProductName', example='ECS'),
        }
      ](name='ProductList'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='AC0AB2EC-AFBC-44BA-AE77-132A5A1EC0AD'),
  success?: boolean(name='Success', example='true'),
}

model ListProductsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProductsResponseBody(name='body'),
}

async function listProductsWithOptions(request: ListProductsRequest, runtime: Util.RuntimeOptions): ListProductsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProducts',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProducts(request: ListProductsRequest): ListProductsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProductsWithOptions(request, runtime);
}

model ListTicketNotesRequest {
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  uid?: string(name='Uid'),
}

model ListTicketNotesResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: [ 
    {
      attachments?: [ 
        {
          name?: string(name='Name'),
          url?: string(name='Url'),
        }
      ](name='Attachments'),
      createTime?: long(name='CreateTime', example='1623396736000'),
      dialog?: {
        content?: string(name='Content'),
        schema?: string(name='Schema', example='null'),
      }(name='Dialog'),
      dialogId?: long(name='DialogId', example='9999'),
      status?: int32(name='Status', example='6'),
      tip?: string(name='Tip', example='null'),
      type?: int32(name='Type', example='1'),
      user?: {
        name?: string(name='Name'),
        role?: int32(name='Role', example='3'),
      }(name='User'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='AC0AB2EC-AFBC-44BA-AE77-132A5A1EC0AD'),
  success?: boolean(name='Success', example='true'),
}

model ListTicketNotesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTicketNotesResponseBody(name='body'),
}

async function listTicketNotesWithOptions(request: ListTicketNotesRequest, runtime: Util.RuntimeOptions): ListTicketNotesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ticketId)) {
    query['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTicketNotes',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTicketNotes(request: ListTicketNotesRequest): ListTicketNotesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTicketNotesWithOptions(request, runtime);
}

model ListTicketsRequest {
  endDate?: long(name='EndDate', example='1623396736000'),
  keyword?: string(name='Keyword', example='ecs'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  startDate?: long(name='StartDate', example='1623396736000'),
  statusList?: [ string ](name='StatusList', example='6'),
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  ticketIdList?: [ string ](name='TicketIdList'),
  uid?: string(name='Uid'),
}

model ListTicketsShrinkRequest {
  endDate?: long(name='EndDate', example='1623396736000'),
  keyword?: string(name='Keyword', example='ecs'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  startDate?: long(name='StartDate', example='1623396736000'),
  statusList?: [ string ](name='StatusList', example='6'),
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  ticketIdListShrink?: string(name='TicketIdList'),
  uid?: string(name='Uid'),
}

model ListTicketsResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: [ 
    {
      status?: {
        label?: string(name='Label'),
        value?: string(name='Value', example='6'),
      }(name='Status'),
      ticketId?: string(name='TicketId', example='0005PYGCW'),
      title?: string(name='Title'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='AC0AB2EC-AFBC-44BA-AE77-132A5A1EC0AD'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='99'),
}

model ListTicketsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListTicketsResponseBody(name='body'),
}

async function listTicketsWithOptions(tmpReq: ListTicketsRequest, runtime: Util.RuntimeOptions): ListTicketsResponse {
  Util.validateModel(tmpReq);
  var request = new ListTicketsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ticketIdList)) {
    request.ticketIdListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ticketIdList, 'TicketIdList', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.endDate)) {
    body['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.keyword)) {
    body['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.startDate)) {
    body['StartDate'] = request.startDate;
  }
  if (!Util.isUnset(request.statusList)) {
    body['StatusList'] = request.statusList;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.ticketIdListShrink)) {
    body['TicketIdList'] = request.ticketIdListShrink;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListTickets',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTickets(request: ListTicketsRequest): ListTicketsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTicketsWithOptions(request, runtime);
}

model ReopenTicketRequest {
  content?: string(name='Content'),
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  uid?: string(name='Uid'),
}

model ReopenTicketResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: string(name='Data'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='C1DA4C6F-963E-5741-AB57-67A554D102FD'),
  success?: boolean(name='Success', example='true'),
}

model ReopenTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReopenTicketResponseBody(name='body'),
}

async function reopenTicketWithOptions(request: ReopenTicketRequest, runtime: Util.RuntimeOptions): ReopenTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReopenTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function reopenTicket(request: ReopenTicketRequest): ReopenTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return reopenTicketWithOptions(request, runtime);
}

model ReplyTicketRequest {
  content?: string(name='Content'),
  encrypt?: boolean(name='Encrypt', example='false'),
  fileNameList?: [ string ](name='FileNameList'),
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  uid?: string(name='Uid'),
}

model ReplyTicketShrinkRequest {
  content?: string(name='Content'),
  encrypt?: boolean(name='Encrypt', example='false'),
  fileNameListShrink?: string(name='FileNameList'),
  ticketId?: string(name='TicketId', example='0005PYGCW'),
  uid?: string(name='Uid'),
}

model ReplyTicketResponseBody = {
  code?: int32(name='Code', example='0'),
  data?: string(name='Data', example='46434030'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='C1DA4C6F-963E-5741-AB57-67A554D102FD'),
  success?: boolean(name='Success', example='true'),
}

model ReplyTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ReplyTicketResponseBody(name='body'),
}

async function replyTicketWithOptions(tmpReq: ReplyTicketRequest, runtime: Util.RuntimeOptions): ReplyTicketResponse {
  Util.validateModel(tmpReq);
  var request = new ReplyTicketShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.fileNameList)) {
    request.fileNameListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.fileNameList, 'FileNameList', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.fileNameListShrink)) {
    query['FileNameList'] = request.fileNameListShrink;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.encrypt)) {
    body['Encrypt'] = request.encrypt;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  if (!Util.isUnset(request.uid)) {
    body['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ReplyTicket',
    version = '2021-06-10',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function replyTicket(request: ReplyTicketRequest): ReplyTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return replyTicketWithOptions(request, runtime);
}

